<?php

error_reporting(E_ALL);
ini_set('display_errors', '1');

/* Start session if it isn't already started */
if(!isset($_SESSION))
{
  session_start();
}

if(!isset($_SESSION['email']))
{
  header('Location: login.php?redirect=true');
}
else
{
  include_once("includes/config.inc.php");
  include_once(MYSQL);
  include('php/status_handler.php');
  $statusHandler = new StatusHandler($dbc);
}

?>

<?php include("includes/header.php"); ?>

<style>
  #page_divider
  {
    border-top: 1px dotted gray;
    width: 900px;
    margin: 20px auto;
  }
  #user_details h3
  {
    margin: 5px;
    padding: 0;
    color: #5f0808;
  }
  #user_details p
  {
    font-size: 90%;
    margin: 0 0 0 5px;
    padding: 3px 0 0 0;
  }
  #user_reviews h3
  {
    margin: 5px;
    padding: 0;
    color: #5f0808;
    font-size: 90%;
  }
  #single_review
  {
    background-color: white;
    width: 800px;
    margin: 10px auto;
    border: 1px solid #e1e1e1;
    padding: 5px;
    overflow: auto;
  }
  #single_review a
  {
    color: #5f0808;
  }
  #single_review p
  {
    padding-left: 10px;
    font-size: 90%;
  }
  .rating
  {
    float: right; 
    padding-bottom: 0px;
    margin-bottom: 0px;
    font-size: 90%;
  }
  #status_links
  {
    text-align:center;
    font-size: 80%;
    margin-bottom: 20px;
  }
  #status_links a
  {
    color: #5f0808;
  }
</style>

<div id="user_details">
  <?php $statusHandler->displayUserDetails(); ?>
</div>

<div id="page_divider"></div>

<div id="user_reviews">
  <h3>Your reviews:</h3>
  <?php $statusHandler->displayReviews(); ?>
</div>

<div id="page_divider"></div>

<div id="status_links">
  <a href="password_forgot.php">Reset Password</a>
</div>
<?php include("includes/footer.php"); ?>
